#req=urllib.request.urlopen(url="http://localhost/temp/post.php?id=123")
#print(req.read().decode('utf-8'))
import urllib.request
import random
ids=['ff80808151c4ea280151ccd11cdd5204',
    'ff80808151c4ea280151ccd14ae8522c',
    'ff80808151c4ea280151ccd14a8f5228',
    'ff80808151c4ea280151ccd14a4d5226',
    'ff80808151c4ea280151ccd149d65224']
for id in ids:
    ti=str(random.randint(1500, 1800))
    url='http://hdpx.webtrn.cn/learning/entity/first/peTchCoursewareItem_saveStudyTime.action?course_id='+id+'&msg='+ti
    cookies='JSESSIONID=ECCE3FBD83DEB1CB06FF2857CF7C09DB.web127_tyxl_learning; _uid=7bb0fbfb-41fb-4941-820b-313fcdb10533; _whatycms=gImVOCRccW; UC00OOIIll11="eW54eTE1MDYxMjM6LTE6NmVjMTI3M2YyNzNmMmJjMWNmY2RmMWI5MjVlN2JiYTk6bnVsbDpoZHB4LndlYnRybi5jbg=="; JSESSIONID=C1ECA807698FCBFDE87AEB92B95DD232.web129_tyxl'
    data = urllib.parse.urlencode({})
    data = data.encode('utf-8')
    req = urllib.request.Request(url=url,method='POST')
    req.add_header('Referer', 'http://hdpx.webtrn.cn/learning/entity/first/peTchCoursewareItem_toMode.action?course_id='+id)
    req.add_header('Host', 'hdpx.webtrn.cn')
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0')
    #req.add_header("Content-Type","application/x-www-form-urlencoded;charset=utf-8")
    req.add_header('X-Requested-With', 'XMLHttpRequest')
    req.add_header('Cookie', cookies)
    r = urllib.request.urlopen(req,data)
    print(r.read().decode('utf-8'))
input()
